<template>
	<view class="profileInfoDetailBox">
		<!-- 标题 -->
		<view class="title">{{title[activeIndex]}}</view>
		<!-- 用户具体信息 -->
		<view class="detailsInfoBox">
			<!-- 信息列表 -->
			<view class="detailsInfoItem" v-for="(item,index) in currentList" :key="index" @click="goToDetails(index)">
				<!-- 图片 -->
				<view class="image">
					<image :src="item.image" mode="center">
					</image>
				</view>
				<!-- 具体消息 -->
				<view class="info">
					<!-- 标题 -->
					<view class="titleItem">{{item.title}}</view>
					<!-- 内容 -->
					<view class="content">{{item.content}}</view>
					<!-- 头像 -->
					<view class="userInfo">
						<!-- 头像 -->
						<view class="avatarBox">
							<image :src="item.avatarUrl" mode=""></image>
						</view>
						<!-- 昵称 -->
						<view class="nickName">{{item.nickName}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'profileInfoDetail',
		data() {
			return {
				title: ['我的发布', '我的喜欢', '浏览历史']
			}
		},
		props: {
			activeIndex: {
				type: Number,
				default: 0
			},
			currentList:{
				type: Array,
				default: []
			}
		},
		methods: {
			goToDetails(index) {
				console.log(this.currentList[index]);
				const result = this.currentList[index]
				uni.navigateTo({
					url:`/pages/details/details?id=${result._id}&type=${result.type}`
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.profileInfoDetailBox {
		width: 95vw;

		// 标题
		.title {
			font-size: 36rpx;
			font-weight: bold;
			padding-bottom: 20rpx;
			border-bottom: 1rpx solid #efefef;
		}

		// 用户具体信息
		.detailsInfoBox {
			.detailsInfoItem {
				width: 100%;
				height: 150rpx;
				border-bottom: 1rpx solid #efefef;
				border-radius: 10rpx;
				display: flex;
				justify-content: space-between;

				.image {
					height: 150rpx;
					width: 200rpx;
					overflow: hidden;

					image {
						width: 200rpx;
						height: 200rpx;
					}
				}

				.info {
					width: 500rpx;
					height: 100%;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.titleItem {
						font-size: 34rpx;
						font-weight: bold;
						margin-bottom: 5rpx;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}

					.content {
						font-size: 30rpx;
						color: #999999;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}

					.userInfo {
						display: flex;
						align-items: center;
						justify-content: flex-end;
						margin-right: 30rpx;

						.avatarBox {
							width: 50rpx;
							height: 50rpx;
							overflow: hidden;
							border-radius: 50%;
							margin-right: 10rpx;

							image {
								width: 100%;
								height: 100%;
							}
						}

						.nickName {
							font-size: 26rpx;
							color: #999999;
						}
					}
				}
			}
		}
	}
</style>
